package al.xc.task;

import al.xc.common.task.ITaskRunnable;

import java.util.Objects;

public interface ILogicTask extends ITaskRunnable {

    /**
     * 任务key
     */
    class TaskKey {
        Integer type_;
        String index_;

        public TaskKey(Integer type, String index) {
            this.type_ = type;
            this.index_ = index;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof TaskKey)) return false;
            TaskKey taskKey = (TaskKey) o;
            return (type_ == taskKey.type_ && index_.equals(taskKey.index_));
        }

        @Override
        public int hashCode() {
            return Objects.hash(type_, index_);
        }

        public Integer getType() {
            return type_;
        }

        public void setType(Integer type) {
            this.type_ = type;
        }

        public String getIndex() {
            return index_;
        }

        public void setIndex(String index) {
            this.index_ = index;
        }
    }

    /**
     * 获取key
     * @return key
     */
    TaskKey getKey();
}
